var yongyaofanan =function (){
	this.getItem = function(key){
		return JSON.parse(window.localStorage.getItem(key))||{};//取值
	},
	this.setItem = function(key,item){
		window.localStorage.setItem(key,JSON.stringify(item));//存值
		ObjAll = item;
	},
	this.removeItem = function(key){
		window.localStorage.removeItem(key);//刪除
		
	},
	this.clear = function(){
		window.localStorage.clear();//刪除全部
		
	},
	this.update = function(key,value){
		var item = this.getItem();
		console.log(item);
		item[key] = value;
		this.setItem(item);
	}
}
var newobj=new yongyaofanan();


function shuaxin(url,listajax){	
	mui.init({
	    pullRefresh: {
	      container: '#pullrefresh',
	     down: {
	        callback: pulldownRefresh
	      },
	      up: {
	        contentrefresh: '正在加载...',
	        callback: pullupRefresh
	      }
	    }
	});
	
	var count = 0;
	var totalNumber  ;//总条数

	/**
	   * 下拉刷新具体业务实现
	*/
	function pulldownRefresh() {
	    setTimeout(function() {	          
	      mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //refresh completed
	    },500);
	
	}
	/**
	   * 上拉加载具体业务实现
	*/
	function pullupRefresh() {
	
	    setTimeout(function() { 
	      mui('#pullrefresh').pullRefresh().endPullupToRefresh((++count >= totalNumber+1)); //参数为true代表没有更多数据了。
			listajax(url,count)
	    }, 500);
	}
	
	if(mui.os.plus) {
	    mui.plusReady(function() {
	      	setTimeout(function() {
	        	mui('#pullrefresh').pullRefresh().pullupLoading();
	  		}, 500);
	
	    });
	} else {
	    mui.ready(function() {
	      mui('#pullrefresh').pullRefresh().pullupLoading();
	    });
	}
	
}